﻿<%@ Page Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="CampaignList.aspx.cs"
    Inherits="iOak.Web.Administration.CampaignList" %>

<%@ Register Src="~/Modules/PagerControl.ascx" TagName="PagerControl" TagPrefix="iOak" %>
<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <style type="text/css">
        .hide
        {
            display: none;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#<%=txtStartDate.ClientID %>').datepicker();
            $('#<%=txtEndDate.ClientID %>').datepicker();

            $("#dialog-UserList").dialog({
                resizable: false,
                modal: true,
                autoOpen: false,
                draggable: false,
                buttons: {
                    "确定": function () {
                        var userIdlist = "";
                        //生成人员ID列表字符串
                        $(".userList input").each(function () {
                            if (this.checked) {
                                userIdlist += $(this).val() + ',';
                            }
                        });
                        //检查是否选择了人员
                        if (userIdlist == "") {
                            jAlert("请选择指派的人员！");
                            return;
                        }
                        //关闭弹出框
                        $(this).dialog("close");
                        doPostBack("assign", $(this).data('id') + '|' + userIdlist);
                    },
                    "取消": function () {
                        $(this).dialog("close");
                    }
                }
            });

            $('#<%=btnCreate.ClientID %>').bind('click', function () {
                window.location = "CampaignDetails.aspx";
                return false;
            });
        });

        function modifyClick(id) {
            location.href = "CampaignDetails.aspx?campaignId=" + id;
        }

        function deleteClick(id) {
            jConfirm("是否确定删除？", function () {
                doPostBack("delete", id);
            });
        }

        function previewClick(id) {
            location.href = "ApplicationList.aspx?campaignId=" + id;
        }

        function exportClick(id) {
            doPostBack("export", id);
        }

        function openClick(id) {
            jConfirm("是否要发布该人才申报？", function () {
                doPostBack("open", id);
            });
        }

        function checkingClick(id) {
            jConfirm("是否要对该人才申报执行审核？", function () {
                doPostBack("checking", id);
            });
        }

        function closeClick(id, existSubmitted) {
            var msg = "是否确定要关闭该人才申报？";
            if (existSubmitted) {
                msg = "存在尚未审核完成的申请，" + msg;
            }
            jConfirm(msg, function () {
                doPostBack("close", id);
            });
        }

        function assignClick(id) {
            $(".userList input").each(function () {
                this.checked = true;
            });
            $("#dialog-UserList").data('id', id);
            $("#dialog-UserList").dialog('open');
        }

        function doPostBack(name, args) {
            $('#<%=hidEventName.ClientID %>').val(name);
            $('#<%=hidEventArguments.ClientID %>').val(args);
            $('#<%=btnPostBack.ClientID %>').click();
        }

    </script>
    <div id="dialog-UserList" title="审核任务分配">
        指派给:
        <div style="border: 1px; border-style: solid; border-color: Gray; text-align: center">
            <asp:CheckBoxList runat="server" ID="chklUserList" RepeatColumns="3" RepeatDirection="Horizontal"
                CssClass="userList" CellPadding="15" CellSpacing="15">
            </asp:CheckBoxList>
        </div>
        <br />
        *依申请书平均指派
    </div>
    <div class="content">
        <div class="left_bar">
            <div class="left_menu">
                <div class="left_menu_top">
                    搜索
                </div>
                <div class="sub_menu">
                    <table style="padding: 10px">
                        <tr>
                            <td>
                                申报名称
                                <asp:TextBox runat="server" ID="txtSubject"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                申请起始日
                                <asp:TextBox runat="server" ID="txtStartDate"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                申请截止日
                                <asp:TextBox runat="server" ID="txtEndDate"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                申报状态<br />
                                <asp:DropDownList runat="server" ID="ddlStatus" Style="border: 1px solid #ccc;">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <br />
                                <asp:Button runat="server" ID="btnFind" Text="搜索" OnClick="btnFind_Click" CssClass="adminButtonBlue" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div class="right_bar">
            <div class="right_content">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #fff;">
                    <tr>
                        <td width="7" align="left" valign="top">
                            <img src="/images/tab-j_01.jpg" width="7" height="7" />
                        </td>
                        <td>
                            <div class="now-pac">
                                您现在的位置：<a href="#">人才申报</a> &gt; 申报</div>
                        </td>
                        <td width="7" align="right" valign="top">
                            <img src="/images/tab-j_02.jpg" width="7" height="7" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <div style="border: 1px solid #ccc">
                                <div style="border: 1px solid #fff">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab1">
                                        <tr>
                                            <td>
                                                <div class="table-header">
                                                    <div class="table-header_name" style="float: left">
                                                        人才申报</div>
                                                    <div style="float: right; padding-right: 10px; padding-top: 8px">
                                                    <asp:Button runat="server" ID="buttonExport" Text="导出汇总表" 
                                                            CssClass="adminButtonBlue" onclick="buttonExport_Click" />
                                                        <asp:Button runat="server" ID="btnCreate" Text="创建申报" CssClass="adminButtonBlue" />
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:GridView runat="server" ID="gvCampaign" Width="100%" AutoGenerateColumns="false"
                                                    OnRowDataBound="gvCampaign_RowDataBound" CssClass="tab1">
                                                    <HeaderStyle CssClass="tab1_green" />
                                                    <RowStyle CssClass="itemRow" />
                                                    <AlternatingRowStyle CssClass="alternatingRow" />
                                                    <Columns>
                                                        <asp:TemplateField HeaderText="No." ItemStyle-HorizontalAlign="Right" ItemStyle-Width="15px">
                                                            <ItemTemplate>
                                                                <%# gvCampaign.PageIndex * gvCampaign.PageSize + Container.DisplayIndex + 1%>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:BoundField HeaderText="名称" DataField="Subject" ItemStyle-HorizontalAlign="Left" />
                                                        <asp:TemplateField HeaderText="起始日" ItemStyle-Width="70px">
                                                            <ItemTemplate>
                                                                <%# ((DateTime)DataBinder.Eval(Container.DataItem, "StartDate")).ToString("yyyy-MM-dd")%>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="截止日" ItemStyle-Width="70px">
                                                            <ItemTemplate>
                                                                <%# ((DateTime)DataBinder.Eval(Container.DataItem, "EndDate")).ToString("yyyy-MM-dd")%>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="收到申请数" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="70px">
                                                            <ItemTemplate>
                                                                <asp:Label runat="server" ID="lblReceiveCount"></asp:Label>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="符合人数" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="65px">
                                                            <ItemTemplate>
                                                                <asp:Label runat="server" ID="lblMeetCount"></asp:Label>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="候选人数" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="65px">
                                                            <ItemTemplate>
                                                                <asp:Label runat="server" ID="lblCandidateCount"></asp:Label>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="状态" ItemStyle-Width="60px">
                                                            <ItemTemplate>
                                                                <asp:Label runat="server" ID="lblStatus"></asp:Label>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="操作" ItemStyle-Width="40px">
                                                            <ItemTemplate>
                                                                <asp:Image runat="server" ID="imgOptionMenu" ImageUrl="~/Images/opetionMenu.gif"
                                                                    onclick="$('.optionMenu').show()" Style="cursor: pointer" />
                                                                <ajaxToolkit:PopupControlExtender ID="PopupControlExtender2" runat="server" TargetControlID="imgOptionMenu"
                                                                    PopupControlID="pnlOptionMenu" Position="Bottom" />
                                                                <asp:Panel ID="pnlOptionMenu" runat="server" Style="display: none">
                                                                    <div class="optionMenu">
                                                                        <asp:PlaceHolder ID="phModify" runat="server">
                                                                            <div onclick="$('.optionMenu').hide();modifyClick('<%#DataBinder.Eval(Container.DataItem, "CampaignId") %>');">
                                                                                修改
                                                                            </div>
                                                                        </asp:PlaceHolder>
                                                                        <asp:PlaceHolder ID="phDelete" runat="server">
                                                                            <div onclick="$('.optionMenu').hide();deleteClick('<%#DataBinder.Eval(Container.DataItem, "CampaignId") %>')">
                                                                                删除
                                                                            </div>
                                                                        </asp:PlaceHolder>
                                                                        <asp:PlaceHolder ID="phPreview" runat="server">
                                                                            <div onclick="$('.optionMenu').hide();previewClick('<%#DataBinder.Eval(Container.DataItem, "CampaignId") %>')">
                                                                                <asp:Label runat="server" ID="lblPreview">预览申请书</asp:Label>
                                                                            </div>
                                                                        </asp:PlaceHolder>
                                                                        <asp:PlaceHolder ID="phOpen" runat="server">
                                                                            <div onclick="$('.optionMenu').hide();openClick('<%#DataBinder.Eval(Container.DataItem, "CampaignId") %>')">
                                                                                发布
                                                                            </div>
                                                                        </asp:PlaceHolder>
                                                                        <asp:PlaceHolder ID="phChecking" runat="server" Visible="false">
                                                                            <div onclick="$('.optionMenu').hide();checkingClick('<%#DataBinder.Eval(Container.DataItem, "CampaignId") %>')">
                                                                                执行审核
                                                                            </div>
                                                                        </asp:PlaceHolder>
                                                                        <asp:PlaceHolder ID="phAssign" runat="server" Visible="false">
                                                                            <div onclick="$('.optionMenu').hide();assignClick('<%#DataBinder.Eval(Container.DataItem, "CampaignId") %>')">
                                                                                分配任务
                                                                            </div>
                                                                        </asp:PlaceHolder>
                                                                        <asp:PlaceHolder ID="phClose" runat="server">
                                                                            <div runat="server" id="divClose">
                                                                                关闭
                                                                            </div>
                                                                        </asp:PlaceHolder>
                                                                        <asp:PlaceHolder ID="phExport" runat="server">
                                                                            <div onclick="$('.optionMenu').hide();exportClick('<%#DataBinder.Eval(Container.DataItem, "CampaignId") %>')">
                                                                                导出汇总报表
                                                                            </div>
                                                                        </asp:PlaceHolder>
                                                                    </div>
                                                                </asp:Panel>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                    </Columns>
                                                </asp:GridView>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <iOak:PagerControl runat="server" ID="pagerControl" PageIndexChange="pagerControl_PageIndexChange">
                                                </iOak:PagerControl>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <asp:Button runat="server" ID="btnPostBack" CssClass="hidden" OnClick="btnPostBack_Click" />
    <asp:HiddenField runat="server" ID="hidEventName" />
    <asp:HiddenField runat="server" ID="hidEventArguments" />
</asp:Content>
